<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>卡厂付款登记</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script src="${pageContext.request.contextPath }/scripts/boot.js"
	type="text/javascript"></script>
<style type="text/css">
<!--
#Layer1 {
	position: absolute;
	left: 20%;
	top: 94px;
	width: 628px;
	height: 325px;
	z-index: 1;
}
-->
</style>
</head>

<body>

	<div id="Layer1">
		<form id="form">
			<div style="width:100%;" align="center">
				<div class="mini-toolbar" style="border-bottom:0;padding:0px;">
					<table style="width:100%;">
						<tr>
							<td style="width:100%;text-align:center;"><font face="宋体"><strong>卡厂付款登记</strong>
							</font>
							</td>
						</tr>
					</table>
				</div>
			</div>
			<div>
				<table style="width:100%;border:solid 1px #aaa;width:100%;">
					<tr>
						<td height="49"
							style="white-space:nowrap;width:90px ;text-align:right">制卡批次</td>
						<td><input name="aaz001" class="mini-textbox" width="80%"
							emptyText="请输入制卡批次"  required="true" />
						</td>
						<td style="white-space:nowrap;width:90px ;text-align:right">银行</td>
						<td><input name="aae008" class="mini-combobox" width="80%"
							textField="aaa103" valueField="aaa102" emptyText="请选择..."
							required="true"
							url="${pageContext.request.contextPath }/kid.do?method=getyinhang&sj=bank"
							onvaluechanged="getValue" />
						</td>
					</tr>
					<tr>
						<td height="40"
							style="white-space:nowrap;width:90px ;text-align:right">付款时间</td>
						<td><input name="aaz714" class="mini-datepicker" width="80%"
							required="true" emptyText="请输入付款时间" ondrawdate="onDrawDate"/>
						</td>
						<td style="white-space:nowrap;width:90px ;text-align:right">付款金额</td>
						<td><input name="aaz713" class="mini-spinner" width="80%"
							required="true" emptyText="请输入付款金额"  minValue="0" maxValue="100000000" format="¥#,0.00"/>
						</td>
					</tr>
					<tr>
						<td height="45"
							style="white-space:nowrap;width:90px ;text-align:right">到卡数量</td>
						<td><input name="aaz709" class="mini-textbox" width="80%"
							inputStyle="background:rgb(241,241,243)" allowInput="false"
							readonly="true"  required="true"/>
						</td>
						<td></td>
						<td></td>
					</tr>
					<tr>
						<td height="40" colspan="4" style="width:100%;text-align:center;">
							<a class="mini-button" iconCls="icon-ok" onclick="onOk">确认</a> <a
							class="mini-button" iconCls="icon-remove" onclick="onReset">重置</a>
						</td>
					</tr>
				</table>
			</div>
		</form>
	</div>
	<script type="text/javascript">
		mini.parse();
		var form = new mini.Form("form");
		function onOk(e) {

			SaveData();
		}

		function SaveData() {
			var o = form.getData();
			form.validate();
			var aaz713=mini.getbyName("aaz713").getValue();
			var json = mini.encode([ o ]);
			if (form.isValid() == false) {
				return;
			} else if(aaz713==0){
			   mini.alert("请输入正确的付款金额！");
			   return;
			}
			else {
				$.ajax({
					url : "/sbk/kid.do?method=kcfkdj",
					type : 'post',
					data : {
						data : json
					},
					cache : false,
					success : function(text) {
					    mini.alert(text);
					    mini.getbyName("aaz001").setEnabled(true);
						form.clear();
					},
					error : function(jqXHR, textStatus, errorThrown) {
						mini.alert(jqXHR.responseText);
					}
				});
			}
		}
		function onDrawDate(e) {
            var date = e.date;
            var d = new Date();

            if (date.getTime() > d.getTime()) {
                e.allowSelect = false;
            }
        }
		function getValue() {
		    
			var aaz001 = mini.getbyName("aaz001").getValue().trim();
			var aae008 = mini.getbyName("aae008").getValue().trim();
			if (aaz001 == "") {
				mini.alert("请输入制卡批次！");
				return;
			} else {
			    
				$.ajax({
					url : "/sbk/kid.do?method=getnumber",
					data : {
						id : aaz001,
						bank : aae008
					},
					success : function(text) {
						var o = mini.decode(text);
						if (o.error != ""&& o.error !=null) {
							mini.alert(o.error);
						} else {
						    mini.getbyName("aaz001").setEnabled(false);
							mini.getbyName("aaz709").setValue(o.aaz709);
						}
					}
				});
			}
		}

		function onReset(e) {
		    mini.getbyName("aaz001").setEnabled(true);
			form.clear();
		}
	</script>
</body>
</html>
